/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lc3vm;

/**
 *
 * @author Administrator
 */
import javax.swing.*;
import java.awt.*;
import javax.swing.table.DefaultTableModel;

public class PanelRegistros extends JPanel{

    private static String[] encabezado = {"Registro","Valor"};
    private static Registros inicializador = new Registros();
    private static DefaultTableModel tablemodel = new DefaultTableModel(Registros.getRegistros(),encabezado);
    private static JTable table = new JTable();
    private static JScrollPane barras = new JScrollPane();

    public PanelRegistros(){

       table.setModel(tablemodel);
       barras = new JScrollPane(table);
       barras.createHorizontalScrollBar();
       barras.setPreferredSize(new Dimension(100,147));
       add(barras);
    }

    public static void updateRegistros(){

        System.out.println("R0: " + Registros.getR(0));
        System.out.println("R1: " + Registros.getR(1));
        System.out.println("R2: " + Registros.getR(2));
        System.out.println("R3: " + Registros.getR(3));
        System.out.println("R4: " + Registros.getR(4));
        System.out.println("R5: " + Registros.getR(5));
        System.out.println("R6: " + Registros.getR(6));
        System.out.println("R7: " + Registros.getR(7));
        for(int i = 0; i < 8; i++){
            tablemodel.setValueAt(Registros.getR(i), i, 1);
        }
    }
}
